<@master template="/common/master"  title="登陆">
<@css href="/css/wx/recruit/dk.css" rel="stylesheet"/>
	<div class="fromDiv1" id="subForm">
	<div class="yytlogo"><@img src="/images/public/logo.png"/></div>
	<ul>
    	<li>
    		<span class="Div-img">
    		<@img src="/images/wx/recruit/login-reg/id.png"/>
    	</span><input name="tel" type="tel" placeholder="手机号码"></li>
        <li><span class="pass-img">
    		<@img src="/images/wx/recruit/login-reg/password.png" alt=""/>
    	</span><input name="password" type="password" placeholder="密码"></li>
    </ul>
	<a id="subBtn" href="javascript:void(0)" class="Sbtn">登录</a>
	<a href="/eascs-o2o-h5/uc/register/index" id="quick">立即注册</a>
	</div>
<div id="showMsgDiv" class="tcTxt1 smDiv" style="display:none;">
    <div class="tcjz"></div>
</div>
</@master>
<script>
	 document.getElementById("showMsgDiv").style.height = document.body.clientHeight + 'px'; 
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?3ab2a83a372d20f084552b836c038302";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
<@js>
$(document).ready(function(){
		$('#showMsgDiv').bind('click',function(){
			$('#showMsgDiv').hide();
		});
    	$('#subBtn').bind("click",function(){
    		if(!validate()) {
    			$("#showMsgDiv").show(1000).delay(1000).fadeOut("hide"); 
    			return false;
    		}
    		var mobile=$('#subForm input[name="tel"]').val();
    		var password = $('#subForm input[name="password"]').val();
    		$.get("/eascs-o2o-h5/uc/rest/login",{'mobile':mobile,'password':password},function(msg) {
    			if (msg.data.success) {
    				window.location.href = "/eascs-o2o-h5/uc/account/index";
    			} else {
    				$('#showMsgDiv .tcjz').text(msg.data.errMsg).parent().show();
    				$("#showMsgDiv").show(1000).delay(1000).fadeOut("hide"); 
    			}
    		});
    	});
	});
	
	function validate() {
        	var rege=/^(?:13\d|14\d|15\d|17\d|18\d)-?\d{5}(\d{3}|\*{3})$/;
    		var mobile=$('#subForm input[name="tel"]').val();
    		if (!mobile) {
    			$('#showMsgDiv .tcjz').text("手机号码不能为空").parent().show();
    			return false;
    		}
    		if(!rege.test(mobile)){
    			$('#showMsgDiv .tcjz').text("手机号码格式不正确").parent().show();
    			return false;
    		}
  			var password = $('#subForm input[name="password"]').val();
  			if(!password){
    			$('#showMsgDiv .tcjz').text("密码不能为空").parent().show();
    			return false;
    		}
    		if(password.length < 6 || password.length > 16 ){
    			$('#showMsgDiv .tcjz').text("密码格式不正确").parent().show();
    			return false;
    		}		
    		return true;
	}
</@js> <@jsRender/>
